package com.moon.producer01.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProducerController {
    @RequestMapping(value = "/index")
   // @HystrixCommand(fallbackMethod = "index2")//熔断 调用fun2
    public String index(){
        int a= 1/0;  //服务熔断 处理过程在服务端  ，服务降级处理逻辑在客户端。
        String index = "producer01.......";
        System.out.println("producer01.......");
        return index;
    }

    public String index2(){
        System.out.println("index2");
        return "index2";
    }
}
